package com.artqiyi.dollmachine.views.adapter;

import android.support.annotation.Nullable;

import com.artqiyi.dollmachine.R;
import com.artqiyi.dollmachine.model.entity.CoinBuyBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2017/10/30 0030.
 */

public class CoinBuyAdapter extends BaseQuickAdapter<CoinBuyBean, BaseViewHolder>{

    public CoinBuyAdapter(@Nullable List<CoinBuyBean> data) {
        super(R.layout.item_coin_buy, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CoinBuyBean item) {
        helper.setText(R.id.tvCoin, item.getCoin());
        helper.setText(R.id.tvMoney, "￥" + item.getMoney());
        helper.setText(R.id.tvAward, setAwardCoin(item.getCoin_award()));
    }

    private String setAwardCoin(int awardCoin) {
        if (awardCoin != 0) return "(" + String.format(mContext.getString(R.string.award_coin), String.valueOf(awardCoin)) + ")";
        else return "";
    }
}
